package com.dkd.manage.result;

import lombok.Data;

import java.io.Serializable;

@Data
public class Result<T> implements Serializable {

    private Integer code;
    private String msg;
    private T data;

    public Result(Integer code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public static <T> Result<T> success(T data) {
        return new Result<>(1, "", data);
    }

    public static <T> Result<T> success() {
        return new Result<>(1, "", null);
    }

    public static <T> Result<T> error(String msg) {
        return new Result<>(0, msg, null);
    }

}
